<?php $lang = "en" ?>
<h1 class="th"><?= ($lang == "en")?isset($dataStaff['StaffID'])?'Edit JobSeeker':'Add JobSeeker':'แบบฟอร์มใบสมัคร'; ?></h1>
<hr>
<!-- begin job list -->
<?php
$inputName = ($lang == "en")?'Name':'ชื่อ';
$inputGender = ($lang == "en")?'Gender':'เพศ';
$inputDOB = ($lang == "en")?'DateofBirth':'วันเกิด';
$inputNationality = ($lang == "en")?'Nationality':'สัญชาติ';
$inputAddress = ($lang == "en")?'Present address ':'ที่อยู่ปัจจุบัน';
$inputProvince = ($lang == "en")?'Province':'จังหวัด';
$inputZipCode = ($lang == "en")?'Post code':'รหัสไปรษณีย์';
$inputEmail = ($lang == "en")?'Email':'Email';
$inputPhone = ($lang == "en")?'Telephone':'เบอร์โทรศัพท์';
$inputMobile = ($lang == "en")?'Mobile':'เบอร์โทรศัพท์มือถือ';

$inputEducation = ($lang == "en")?'Educational':'การศึกษา';
$inputInstitution = ($lang == "en")?'Institution':'สถาบันการศึกษา';
$inputMajor = ($lang == "en")?'Major':'สาขาวิชา';
$inputEnglish = ($lang == "en")?'English skill':'ทักษะด้านภาษาอังกฤษ';
$inputJapanese = ($lang == "en")?'Japanese skill':'ทักษะด้านภาษาญี่ปุ่น';

$inputWorkposition = ($lang == "en")?'Work position':'ตำแหน่งงานที่ทำ';
$inputWorkexperiencedetail = ($lang == "en")?'Work experience detail':'รายละเอียดงานที่ทำ';
$inputExpectworkingPosition = ($lang == "en")?'Position Applied':'ตำแหน่งงานที่ต้องการ';
$inputExpectworkingLocation = ($lang == "en")?'Expect working location':'สถานที่ทำงานที่ต้องการ';
$inputExpectsalary = ($lang == "en")?'Expect salary':'เงินเดือนที่คาดหวัง';
$inputNote = ($lang == "en")?'Note':'หมายเหตุ';
?>
<div id="ApplicationForm">
    <form class="form-horizontal" action="index.php?r=StaffManage/Save" method="post">
        <input type="hidden" name="JobID" value="<?= isset($dataStaff['JobID'])?$dataStaff['JobID']:0 ?>">
        <input type="hidden" name="StaffID" value="<?= isset($dataStaff['StaffID'])?$dataStaff['StaffID']:'' ?>">
        <div class="control-group">
            <label class="control-label" for="inputPageLang">Show on Page Language</label>
            <div class="controls">
                <select name="lang" id="inputPageLang">
                    <option value="en">English</option>
                    <option value="th">Thai</option>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputName"><?= $inputName ?></label>
            <div class="controls">
                <input type="text" name="Name" id="inputName" placeholder="" required value="<?= isset($dataStaff['StaffName'])?$dataStaff['StaffName']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputGender"><?= $inputGender ?></label>
            <div class="controls">
                <label class="radio inline">
                    <input type="radio" name="Gender" id="inputGenderM" value="M" checked>
                    <?= ($lang == "en")?'Male':'ชาย'; ?>
                </label>
                <label class="radio inline">
                    <input type="radio" name="Gender" id="inputGenderF" value="F">
                    <?= ($lang == "en")?'Female':'หญิง'; ?>
                </label>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputNationality"><?= $inputNationality ?></label>
            <div class="controls">
<!--                <select name="nationality" id="inputNationality">
                    <option value="Thai" selected="selected">ไทย</option>
                    <option value="Japanese">ญี่ปุ่น</option>
                    <option value="Other">อื่นๆ</option>
                </select>-->
                <input type="text" name="Nationality" id="inputNationality" placeholder="" required value="<?= isset($dataStaff['Nationality'])?$dataStaff['Nationality']:'' ?>">
            </div>
        </div>
        
        <div class="control-group">
            <label class="control-label required" for="inputDateofBirth"><?= $inputDOB ?></label>
            <div class="controls">
                <input type="text" name="DOB" id="inputDateofBirth" placeholder="" required value="<?= isset($dataStaff['DOB'])?$dataStaff['DOB']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputAddress"><?= $inputAddress ?></label>
            <div class="controls">
                <textarea name="Address" id="inputAddress" rows="3"><?= isset($dataStaff['Address'])?$dataStaff['Address']:'' ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputProvince"><?= $inputProvince ?></label>
            <div class="controls">
                <select name="Province" id="inputProvince">
                    <?= GM::getOptionDropdownProvince($lang) ?>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputZipCode"><?= $inputZipCode ?></label>
            <div class="controls">
                <input type="text" name="ZipCode" id="inputZipCode" placeholder="" maxlength="5" required value="<?= isset($dataStaff['ZipCode'])?$dataStaff['ZipCode']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputEmail"><?= $inputEmail ?></label>
            <div class="controls">
                <input type="email" name="Email" id="inputEmail" placeholder="" required value="<?= isset($dataStaff['Email'])?$dataStaff['Email']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputPhone"><?= $inputPhone ?></label>
            <div class="controls">
                <input type="tel" name="Phone" id="inputPhone" placeholder="" value="<?= isset($dataStaff['Phone'])?$dataStaff['Phone']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputMobile"><?= $inputMobile ?></label>
            <div class="controls">
                <input type="tel" name="Mobile" id="inputMobile" placeholder="" required value="<?= isset($dataStaff['Mobile'])?$dataStaff['Mobile']:'' ?>">
            </div>
        </div>
        <hr>
        <div class="control-group">
            <label class="control-label" for="inputEducation"><?= $inputEducation ?></label>
            <div class="controls">
                <select name="Education" id="inputEducation">
                    <?= getOptionDropdownEducationalLevel($lang) ?>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputInstitution"><?= $inputInstitution ?></label>
            <div class="controls">
                <input type="text" name="Institution" id="inputInstitution" placeholder="" required value="<?= isset($dataStaff['Institution'])?$dataStaff['Institution']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputMajor"><?= $inputMajor ?></label>
            <div class="controls">
                <input type="text" name="Major" id="inputMajor" placeholder="" required value="<?= isset($dataStaff['Major'])?$dataStaff['Major']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputEnglish"><?= $inputEnglish ?></label>
            <div class="controls">
                <select name="EnSkill" id="inputEnglish">
                    <?= getOptionDropdownLanguageSkill($lang) ?>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputJapanese"><?= $inputJapanese ?></label>
            <div class="controls">
                <select name="JpSkill" id="inputJapanese">
                    <?= getOptionDropdownLanguageSkill($lang) ?>
                </select>
            </div>
        </div>
        <hr>
        <!---->
        <div class="control-group">
            <label class="control-label" for="inputWorkposition"><?= $inputWorkposition ?></label>
            <div class="controls">
                <input type="text" name="WorkPosition" id="inputWorkposition" placeholder="" value="<?= isset($dataStaff['WorkPosition'])?$dataStaff['WorkPosition']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputWorkexperiencedetail"><?= $inputWorkexperiencedetail ?></label>
            <div class="controls">
                <textarea name="WorkExperienceDetail" id="inputWorkexperiencedetail"  rows="5"><?= isset($dataStaff['WorkExperienceDetail'])?$dataStaff['WorkExperienceDetail']:'' ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputExpectworkingPosition"><?= $inputExpectworkingPosition ?></label>
            <div class="controls">
                <input type="text" name="ExpectWorkingPosition" id="inputExpectworkingPosition" placeholder="" required value="<?= isset($dataStaff['ExpectWorkingPosition'])?$dataStaff['ExpectWorkingPosition']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputExpectWorkingLocation"><?= $inputExpectworkingLocation ?></label>
            <div class="controls">
                <select name="ExpectWorkingLocation" id="inputExpectWorkingLocation">
                    <?= GM::getOptionDropdownProvince($lang) ?>
                </select>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label required" for="inputExpectSalary"><?= $inputExpectsalary ?></label>
            <div class="controls">
                <input type="text" name="ExpectSalary" id="inputExpectSalary" placeholder="" required value="<?= isset($dataStaff['ExpectSalary'])?$dataStaff['ExpectSalary']:'' ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputNote"><?= $inputNote ?></label>
            <div class="controls">
                <textarea name="Note" id="inputNote" rows="5"><?= isset($dataStaff['Note'])?$dataStaff['Note']:'' ?></textarea>
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
<!--                <label class="checkbox">
                    <input type="checkbox" name="terms" required 
                        data-validation-required-message="You must agree to the terms and conditions" >
                        terms-and-conditions
                </label>-->
                <input class="btn btn-large btn-primary" type="submit" class="btn" value="<?= ($lang == "en")?'Confirm':'ยืนยัน'; ?>">
            </div>
        </div>
    </form>
</div>
<script>
    $(function () {
        $( "#inputDateofBirth" ).datepicker({
                showAnim:'slideDown',
                dateFormat:'yy-mm-dd',
                firstDay: 1,
                changeMonth: true,
                changeYear: true,
                yearRange: '-60:-15',
                defaultDate: '-15y'
            });
        $("#inputProvince, #inputExpectWorkingLocation").val(1);
        $("input,select,textarea").not("[type=submit]").jqBootstrapValidation();
        
        $('#inputPageLang').val('<?= isset($dataStaff['PageLanguage'])?$dataStaff['PageLanguage']:'' ?>');
        $('#inputGender<?= isset($dataStaff['Gender'])?$dataStaff['Gender']:'' ?>').prop('checked', true);
        $('#inputProvince').val('<?= isset($dataStaff['ProvinceID'])?$dataStaff['ProvinceID']:1 ?>');
        $('#inputEducation').val('<?= isset($dataStaff['Education'])?$dataStaff['Education']:4 ?>');
        $('#inputEnglish').val('<?= isset($dataStaff['EnSkill'])?$dataStaff['EnSkill']:3 ?>');
        $('#inputJapanese').val('<?= isset($dataStaff['JpSkill'])?$dataStaff['JpSkill']:3 ?>');
        $('#inputExpectWorkingLocation').val('<?= isset($dataStaff['ExpectWorkingLocation'])?$dataStaff['ExpectWorkingLocation']:1 ?>');
    } );
</script>
<style>
    #ApplicationForm {
        background-color: #F7F7F7;
        border-radius: 5px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .control-group {
        margin-bottom: 10px !important;
    }
    .radio, .checkbox {
        min-height: 30px;
    }
    .form-horizontal .control-label {
        width: 200px;
    }
    .form-horizontal .controls {
        margin-left: 220px;
    }
</style>
<?php
function getOptionDropdownEducationalLevel($lang){
    if($lang == 'en'){
        return '<option value="5">Post-Graduate</option>
            <option value="4">Bachelor degree</option>
            <option value="3">Diploma</option>
            <option value="2">High school/Vocational</option>
            <option value="1">Others</option>';
    }else{
        return '<option value="5">สูงกว่าปริญญาตรี</option>
            <option value="4" selected="selected">ปริญญาตรี</option>
            <option value="3">ปวส.</option>
            <option value="2">มัธยมศึกษาตอนปลาย/ปวช.</option>
            <option value="1">อื่นๆ</option>';
    }
}

function getOptionDropdownLanguageSkill($lang){
    if($lang == 'en'){
        return '<option value="5">Native</option>
            <option value="4">Business conversation level</option>
            <option value="3" selected="selected">Daily conversation level</option>
            <option value="2">Weak</option>
            <option value="1">Impossible</option>';
    }else{
        return '<option value="5">เจ้าของภาษา</option>
            <option value="4">ระดับสนทนาทางธุรกิจ</option>
            <option value="3" selected="selected">ระดับสนทนาทั่วไป</option>
            <option value="2">ไม่ถนัด</option>
            <option value="1">ไม่สามารถทำได้</option>';
    }
}
?>